﻿@{
    ViewBag.Title = "Chawysiwyg";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head{
    <script type="text/javascript" src="@Url.Content("~/Content/boot/js/bootstrap-wysiwyg.js")"></script>
    <script type="text/javascript">

        $(function () {
            function initToolbarBootstrapBindings() {
                var fonts = ['Serif', 'Sans', 'Arial', 'Arial Black', 'Courier',
            'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande', 'Lucida Sans', 'Tahoma', 'Times',
            'Times New Roman', 'Verdana'],
            fontTarget = $('[title=Font]').siblings('.dropdown-menu');
                $.each(fonts, function (idx, fontName) {
                    fontTarget.append($('<li><a data-edit="fontName ' + fontName + '" style="font-family:\'' + fontName + '\'">' + fontName + '</a></li>'));
                });
                $('a[title]').tooltip({ container: 'body' });
                $('.dropdown-menu input').click(function () { return false; })
		    .change(function () { $(this).parent('.dropdown-menu').siblings('.dropdown-toggle').dropdown('toggle'); })
        .keydown('esc', function () { this.value = ''; $(this).change(); });

                $('[data-role=magic-overlay]').each(function () {
                    var overlay = $(this), target = $(overlay.data('target'));
                    overlay.css('opacity', 0).css('position', 'absolute').offset(target.offset()).width(target.outerWidth()).height(target.outerHeight());
                });
                $('#voiceBtn').hide();
                // if ("onwebkitspeechchange"  in document.createElement("input")) {
                //   var editorOffset = $('#editor').offset();
                //   $('#voiceBtn').css('position','absolute').offset({top: editorOffset.top, left: editorOffset.left+$('#editor').innerWidth()-35});
                // } else {
                //   $('#voiceBtn').hide();
                // }
            };
            initToolbarBootstrapBindings();
            $('#editor').wysiwyg();
            window.prettyPrint && prettyPrint();
        });

    </script>
    <style type="text/css">
        #editor
        {
            max-height: 250px;
            height: 250px;
            background-color: white;
            border-collapse: separate;
            border: 1px solid rgb(204, 204, 204);
            padding: 4px;
            box-sizing: content-box;
            -webkit-box-shadow: rgba(0, 0, 0, 0.0745098) 0px 1px 1px 0px inset;
            box-shadow: rgba(0, 0, 0, 0.0745098) 0px 1px 1px 0px inset;
            border-top-right-radius: 3px;
            border-bottom-right-radius: 3px;
            border-bottom-left-radius: 3px;
            border-top-left-radius: 3px;
            overflow: scroll;
            outline: none;
        }
    </style>
}
<div class="container">
    <h2>
        未找到富文本编辑器</h2>
    <div class="row">
    </div>
</div>
